#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
#include <arpa/inet.h>
#include "expat.h"



#define hash_balise(b) (((*b >= 'a') && (*b <= 'z')) ? (*b - 'a' + 1) : 0)


#define MAX_CLIENTS 10
#define PORT_SERVER 5222
#define REP_MAX_SIZE 1000
#define REQ_MAX_SIZE 10
#define ADR_MAX_SIZE 100

#define CMDLENGTH 10

#define CHAT 1


/* représentation du client au 
niveau du server*/
struct xmppClient {

  int  desc;
  
  //  char xmlVersion[4]; /* ex : 1.0 */
  //  char encoding[5]; /* ex : UTF-8*/


  //  int stream ; /* stream ouvert */

  int state ;

  /* chat */
  char * chat_dest;
  int message_att ;/* message attendu */


  /* namespaces */
  char * register_ns, *auth_ns;


  /* attribut de stream */  
  //  char * to, *from, *id, *xml_lang, *version, *xmlns, *xmlns_stream;
  
  /* curent query */
  //  char * iq_type, * iq_id, * curentOperation;

  /* username + password */
  char * username, * password;

  /* dernière balise rencontrée  */
  char * lastTag;

  /* balise message */
  //  char * message_to, *message_type, * body;

  //  char host [64] ;
};
